<?php
/**
 * Created by JetBrains PhpStorm.
 * User: dung
 * Date: 2/16/14
 * Time: 11:04 PM
 * To change this template use File | Settings | File Templates.
 */
?>
<div id="header"><?php
require './pages/blocks/menu.php';
?></div>
<?php 
if (isset($_GET["page"])) {
	$page  = $_GET["page"];
}else{
	$page=1;
};
$start = ($page-1) * 10;
$employee=EmployeeLists($start);
if(mysql_num_rows($employee)!=0){
?>
<div id="post">
<div id="post-content">
<div class="content">
<h2 class="employee-text">Đội Ngũ Luật Sư</h2>
<ul class="employee-list">
<?php
	while($row_employee=mysql_fetch_array($employee))
	{
		ob_start();
		?>
	<li><a href="index.php?p=employeedetails&id={ID}" title=""> <img src="{Image}" class="employee-avatar" />
	<h3 class="employee-name">{Name}</h3>
	</a></li>
	<?php
		$s= ob_get_clean();
		$s=str_replace("{ID}",$row_employee["employee_id"],$s);
		$s=str_replace("{Name}",$row_employee["name"],$s);
		$s=str_replace("{Detail}",$row_employee["detail"],$s);
		$s=str_replace("{Image}",$row_employee["image"],$s);
		echo $s;
		?>
	<?php }?>
</ul>
<div class="page">
<?php
$qr="SELECT COUNT(employee_id) from dt_employee";
$result=mysql_query($qr);
$row_result=mysql_fetch_array($result);
$records=$row_result[0];
$total_pages=ceil($records/10);
if($total_pages>2){
	echo "Pages ";
	for ($i=1; $i<=$total_pages; $i++) {
		echo "<a href='index.php?p=employeelist&page=".$i."'>".$i."</a> ";
	}
}?></div>

        <?php } else { ?>
            <tbody>
            <tr>
                <td style="text-align: center" class="no-result" colspan="4">
                    <?php echo "No Result!"; ?>
                </td>
            </tr>
            </tbody>
        <?php } ?>
</div>
</div>
<div id="widget"><?php
require './pages/blocks/widget.php';
?></div>
<div class="clear"></div>
</div>
<div id="footer"><?php
require './pages/blocks/footer.php';
?></div>
